package com.jinke.api.security.util;


import com.jinke.api.modules.ums.model.UmsAdmin;

public class AdminUserUtil {

    public static ThreadLocal<UmsAdmin> UserInfoThreadLocal = new ThreadLocal<>();

    /**
     * 获取当前用户信息
     *
     * @return UserInfoBO
     */
    public static UmsAdmin getUserInfo() {
        return UserInfoThreadLocal.get();
    }

    public static Integer getUserId() {
        return UserInfoThreadLocal.get().getId();
    }

    /**
     * 设置当前用户信息
     *
     * @return UserInfoBO
     */
    public static void setUserInfo(UmsAdmin userInfo) {
        UserInfoThreadLocal.set(userInfo);
    }

    /**
     * 清除当前用户信息
     *
     * @return UserInfoBO
     */
    public static void clean() {
        UserInfoThreadLocal.remove();
    }
}
